<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8" />
	<title>test mouse tracker</title>

	<link href="qunit.css" rel="stylesheet" />
	<script src="qunit.js" type="text/javascript"></script>
	<script src="../tooltip.js" type="text/javascript"></script>
</head>
<body>

<h1 id="qunit-header">qUnit</h1>
<h2 id="qunit-banner"></h2>
<h2 id="qunit-userAgent"></h2>
<ol id="qunit-tests"></ol>

<script type="text/javascript">
var rect;
var tracker;
var mousemoveEvent;

module("test class Rectangle", { 
	setup: function(){ rect = new Rectangle({left: 0, top: 0, right: 100, bottom: 100}); } 
});

test("rectangle inside function", function(){
	equal(rect.inside(0, 0), true);
	equal(rect.inside(10, 10), true);
	equal(rect.inside(100, 100), false);
	equal(rect.inside(100, 110), false);
});



module("test class Mousetracker", {
	setup: function(){
		mousemoveEvent = document.createEvent("MouseEvents");
		mousemoveEvent.initEvent("click", true, true, window, 0, 0, 0, 40, 40, false, false, false, false, 0, null);
		
		tracker = new MouseTracker();
		tracker.add(new Rectangle({left: 0, top: 0, right: 100, bottom: 100}));
	}
});

test("mousetrack addEventListener", function(){
	expect(1);
	
	tracker.addEventListener("mosueenter", function(){ ok("invoke mouseenter handler"); });
	tracker.start();
	
	document.dispatchEvent(mousemoveEvent);
});

</script>

</body>
</html>
